/**
 * @ author: 汪孟苹
 */
define(["jquery","bbcare","jquery.dataTables","bootstrap.dataTables",
	"scprit/followup/app/datatable/datatable.servers.js",
	"fu/app/comm/error","fu/app/comm/ajaxCallback"],function($,$bb,$jtable,$btable,$datatableServers,$error,$ajaxCallback){
	var ui = {};

	ui.table = "";
    
	ui.init = function(params){
        $("#"+params.id).css({"width":"100%"});
        $(document).ready(function(){
    		var options = $datatableServers.getOptions(params.options);
    		ui.table = $("#"+params.id).dataTable(options);
            /* 出错时的处理 */
            $.fn.dataTable.ext.errMode = function( settings, tn, msg){};      // 覆盖掉警告弹框（如果有警告的话）
            ui.table.on('xhr.dt',function (e, settings, json, xhr) {
                var obj = $(".content-main .panel-body");
                $error.init(obj,xhr.status,xhr.msg,$ajaxCallback.fail);
            });
        });
	}

	return ui;
});